using System.Drawing;
using GTA;
using NativeUI;

namespace CustomPeds.Menus;

public class VehicleSexMenu : Script
{
	public static UIMenu menu = new UIMenu("", TextSetting.vhcs_Menu, new Point(0, -107));
	private static bool isMenuInitialized;

	public VehicleSexMenu()
	{
		if (!isMenuInitialized)
		{
			Main.pool.Add(menu);
		menu.SetBannerType(new UIResRectangle());
		menu.AddItem(new UIMenuItem(TextSetting.vhcs_MenuItem_Oral));
		menu.AddItem(new UIMenuItem(TextSetting.vhcs_MenuItem_Sex));
		menu.OnItemSelect += OnItemSelect;
		menu.OnMenuClose += OnMenuClose;
		menu.RefreshIndex();
		isMenuInitialized = true;
		}
	}

	private void OnIndexChange(UIMenu sender, int index)
	{
	}

	private void OnItemSelect(UIMenu sender, UIMenuItem item, int index)
	{
		switch (index)
		{
		case 0:
			VehicleSexScript.InitSexPlay(VehicleSexScript.SexType.SexOralSit);
			break;
		case 1:
			VehicleSexScript.InitSexPlay(VehicleSexScript.SexType.SexSit);
			break;
		}
		menu.Visible = false;
	}

	private void OnMenuClose(UIMenu sender)
	{
		menu.Visible = false;
		menu.RefreshIndex();
		VehicleSexScript.StageEnd();
	}
}
